package com.lixw.springai.config;

import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.deepseek.DeepSeekChatModel;
import org.springframework.ai.deepseek.DeepSeekChatOptions;
import org.springframework.ai.deepseek.api.DeepSeekApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: LLMConfig
 * @Description:
 * @Author: xuweiLi
 * @Create: 2025/8/26 09:13
 **/
@Configuration
public class LLMConfig {
    @Bean
    public ChatModel myChatModel() {
        DeepSeekApi.Builder deepseekApi = DeepSeekApi.builder()
                .baseUrl("https://api.deepseek.com")
                .apiKey(System.getenv("DEEPSEEK_API_KEY"));

        return DeepSeekChatModel.builder()
                .deepSeekApi(deepseekApi.build())
                .defaultOptions(
                        DeepSeekChatOptions.builder()
                        .model("deepseek-chat")
                        .build()
                ).build();

    }
}